package com.combat.text.user.mapper;

import com.combat.text.user.entity.userroot;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Author： Lizehui
 * @date: 2020/12/18 17:25
 * @Description:
 */
@Mapper
public interface PowerMapper {
    /**
     * 一级权限
     * @param post
     * @return
     */
    @Select("select b.rno,b.rname from\n" +
            "(select * from userroot where post = #{post})a\n" +
            "left join\n" +
            "(select * from root where rrno = 1)b\n" +
            "on a.rno=b.rno\n" +
            "where b.rno is not null")
    List<Map<String,Object>> selectPower(int post);

    /**
     * 二级权限
     * @param rno
     * @return
     */
    @Select("select * from root where rrno = #{rno};\n")
    List<Map<String,Object>> selectPower1(int rno);
}
